<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
GeneticAlgorithm (Commons Math 3.2 API)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="GeneticAlgorithm (Commons Math 3.2 API)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/GeneticAlgorithm.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/FixedGenerationCount.html" title="class in org.apache.commons.math3.genetics"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/InvalidRepresentationException.html" title="class in org.apache.commons.math3.genetics"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?org/apache/commons/math3/genetics/GeneticAlgorithm.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="GeneticAlgorithm.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.commons.math3.genetics</FONT>
<BR>
Class GeneticAlgorithm</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.commons.math3.genetics.GeneticAlgorithm</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>GeneticAlgorithm</B><DT>extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
Implementation of a genetic algorithm. All factors that govern the operation
 of the algorithm can be configured for a specific problem.
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>2.0</DD>
<DT><B>Version:</B></DT>
  <DD>$Id: GeneticAlgorithm.java 1416643 2012-12-03 19:37:14Z tn $</DD>
</DL>
<HR>

<P>

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#GeneticAlgorithm(org.apache.commons.math3.genetics.CrossoverPolicy, double, org.apache.commons.math3.genetics.MutationPolicy, double, org.apache.commons.math3.genetics.SelectionPolicy)">GeneticAlgorithm</A></B>(<A HREF="../../../../../org/apache/commons/math3/genetics/CrossoverPolicy.html" title="interface in org.apache.commons.math3.genetics">CrossoverPolicy</A>&nbsp;crossoverPolicy,
                 double&nbsp;crossoverRate,
                 <A HREF="../../../../../org/apache/commons/math3/genetics/MutationPolicy.html" title="interface in org.apache.commons.math3.genetics">MutationPolicy</A>&nbsp;mutationPolicy,
                 double&nbsp;mutationRate,
                 <A HREF="../../../../../org/apache/commons/math3/genetics/SelectionPolicy.html" title="interface in org.apache.commons.math3.genetics">SelectionPolicy</A>&nbsp;selectionPolicy)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new genetic algorithm.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#evolve(org.apache.commons.math3.genetics.Population, org.apache.commons.math3.genetics.StoppingCondition)">evolve</A></B>(<A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A>&nbsp;initial,
       <A HREF="../../../../../org/apache/commons/math3/genetics/StoppingCondition.html" title="interface in org.apache.commons.math3.genetics">StoppingCondition</A>&nbsp;condition)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Evolve the given population.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/CrossoverPolicy.html" title="interface in org.apache.commons.math3.genetics">CrossoverPolicy</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getCrossoverPolicy()">getCrossoverPolicy</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the crossover policy.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getCrossoverRate()">getCrossoverRate</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the crossover rate.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getGenerationsEvolved()">getGenerationsEvolved</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of generations evolved to reach <A HREF="../../../../../org/apache/commons/math3/genetics/StoppingCondition.html" title="interface in org.apache.commons.math3.genetics"><CODE>StoppingCondition</CODE></A> in the last run.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/MutationPolicy.html" title="interface in org.apache.commons.math3.genetics">MutationPolicy</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getMutationPolicy()">getMutationPolicy</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the mutation policy.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getMutationRate()">getMutationRate</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the mutation rate.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getRandomGenerator()">getRandomGenerator</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the (static) random generator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/SelectionPolicy.html" title="interface in org.apache.commons.math3.genetics">SelectionPolicy</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getSelectionPolicy()">getSelectionPolicy</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the selection policy.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#nextGeneration(org.apache.commons.math3.genetics.Population)">nextGeneration</A></B>(<A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A>&nbsp;current)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Evolve the given population into the next generation.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#setRandomGenerator(org.apache.commons.math3.random.RandomGenerator)">setRandomGenerator</A></B>(<A HREF="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</A>&nbsp;random)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the (static) random generator.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="GeneticAlgorithm(org.apache.commons.math3.genetics.CrossoverPolicy, double, org.apache.commons.math3.genetics.MutationPolicy, double, org.apache.commons.math3.genetics.SelectionPolicy)"><!-- --></A><H3>
GeneticAlgorithm</H3>
<PRE>
public <B>GeneticAlgorithm</B>(<A HREF="../../../../../org/apache/commons/math3/genetics/CrossoverPolicy.html" title="interface in org.apache.commons.math3.genetics">CrossoverPolicy</A>&nbsp;crossoverPolicy,
                        double&nbsp;crossoverRate,
                        <A HREF="../../../../../org/apache/commons/math3/genetics/MutationPolicy.html" title="interface in org.apache.commons.math3.genetics">MutationPolicy</A>&nbsp;mutationPolicy,
                        double&nbsp;mutationRate,
                        <A HREF="../../../../../org/apache/commons/math3/genetics/SelectionPolicy.html" title="interface in org.apache.commons.math3.genetics">SelectionPolicy</A>&nbsp;selectionPolicy)
                 throws <A HREF="../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</A></PRE>
<DL>
<DD>Create a new genetic algorithm.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>crossoverPolicy</CODE> - The <A HREF="../../../../../org/apache/commons/math3/genetics/CrossoverPolicy.html" title="interface in org.apache.commons.math3.genetics"><CODE>CrossoverPolicy</CODE></A><DD><CODE>crossoverRate</CODE> - The crossover rate as a percentage (0-1 inclusive)<DD><CODE>mutationPolicy</CODE> - The <A HREF="../../../../../org/apache/commons/math3/genetics/MutationPolicy.html" title="interface in org.apache.commons.math3.genetics"><CODE>MutationPolicy</CODE></A><DD><CODE>mutationRate</CODE> - The mutation rate as a percentage (0-1 inclusive)<DD><CODE>selectionPolicy</CODE> - The <A HREF="../../../../../org/apache/commons/math3/genetics/SelectionPolicy.html" title="interface in org.apache.commons.math3.genetics"><CODE>SelectionPolicy</CODE></A>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../../org/apache/commons/math3/exception/OutOfRangeException.html" title="class in org.apache.commons.math3.exception">OutOfRangeException</A></CODE> - if the crossover or mutation rate is outside the [0, 1] range</DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="setRandomGenerator(org.apache.commons.math3.random.RandomGenerator)"><!-- --></A><H3>
setRandomGenerator</H3>
<PRE>
public static void <B>setRandomGenerator</B>(<A HREF="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</A>&nbsp;random)</PRE>
<DL>
<DD>Set the (static) random generator.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>random</CODE> - random generator</DL>
</DD>
</DL>
<HR>

<A NAME="getRandomGenerator()"><!-- --></A><H3>
getRandomGenerator</H3>
<PRE>
public static <A HREF="../../../../../org/apache/commons/math3/random/RandomGenerator.html" title="interface in org.apache.commons.math3.random">RandomGenerator</A> <B>getRandomGenerator</B>()</PRE>
<DL>
<DD>Returns the (static) random generator.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the static random generator shared by GA implementation classes</DL>
</DD>
</DL>
<HR>

<A NAME="evolve(org.apache.commons.math3.genetics.Population, org.apache.commons.math3.genetics.StoppingCondition)"><!-- --></A><H3>
evolve</H3>
<PRE>
public <A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A> <B>evolve</B>(<A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A>&nbsp;initial,
                         <A HREF="../../../../../org/apache/commons/math3/genetics/StoppingCondition.html" title="interface in org.apache.commons.math3.genetics">StoppingCondition</A>&nbsp;condition)</PRE>
<DL>
<DD>Evolve the given population. Evolution stops when the stopping condition
 is satisfied. Updates the <A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getGenerationsEvolved()"><CODE>generationsEvolved</CODE></A>
 property with the number of generations evolved before the StoppingCondition
 is satisfied.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>initial</CODE> - the initial, seed population.<DD><CODE>condition</CODE> - the stopping condition used to stop evolution.
<DT><B>Returns:</B><DD>the population that satisfies the stopping condition.</DL>
</DD>
</DL>
<HR>

<A NAME="nextGeneration(org.apache.commons.math3.genetics.Population)"><!-- --></A><H3>
nextGeneration</H3>
<PRE>
public <A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A> <B>nextGeneration</B>(<A HREF="../../../../../org/apache/commons/math3/genetics/Population.html" title="interface in org.apache.commons.math3.genetics">Population</A>&nbsp;current)</PRE>
<DL>
<DD>Evolve the given population into the next generation.
 <p>
 <ol>
  <li>Get nextGeneration population to fill from <code>current</code>
      generation, using its nextGeneration method</li>
  <li>Loop until new generation is filled:</li>
  <ul><li>Apply configured SelectionPolicy to select a pair of parents
          from <code>current</code></li>
      <li>With probability = <A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getCrossoverRate()"><CODE>getCrossoverRate()</CODE></A>, apply
          configured <A HREF="../../../../../org/apache/commons/math3/genetics/CrossoverPolicy.html" title="interface in org.apache.commons.math3.genetics"><CODE>CrossoverPolicy</CODE></A> to parents</li>
      <li>With probability = <A HREF="../../../../../org/apache/commons/math3/genetics/GeneticAlgorithm.html#getMutationRate()"><CODE>getMutationRate()</CODE></A>, apply
          configured <A HREF="../../../../../org/apache/commons/math3/genetics/MutationPolicy.html" title="interface in org.apache.commons.math3.genetics"><CODE>MutationPolicy</CODE></A> to each of the offspring</li>
      <li>Add offspring individually to nextGeneration,
          space permitting</li>
  </ul>
  <li>Return nextGeneration</li>
 </ol>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>current</CODE> - the current population.
<DT><B>Returns:</B><DD>the population for the next generation.</DL>
</DD>
</DL>
<HR>

<A NAME="getCrossoverPolicy()"><!-- --></A><H3>
getCrossoverPolicy</H3>
<PRE>
public <A HREF="../../../../../org/apache/commons/math3/genetics/CrossoverPolicy.html" title="interface in org.apache.commons.math3.genetics">CrossoverPolicy</A> <B>getCrossoverPolicy</B>()</PRE>
<DL>
<DD>Returns the crossover policy.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>crossover policy</DL>
</DD>
</DL>
<HR>

<A NAME="getCrossoverRate()"><!-- --></A><H3>
getCrossoverRate</H3>
<PRE>
public double <B>getCrossoverRate</B>()</PRE>
<DL>
<DD>Returns the crossover rate.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>crossover rate</DL>
</DD>
</DL>
<HR>

<A NAME="getMutationPolicy()"><!-- --></A><H3>
getMutationPolicy</H3>
<PRE>
public <A HREF="../../../../../org/apache/commons/math3/genetics/MutationPolicy.html" title="interface in org.apache.commons.math3.genetics">MutationPolicy</A> <B>getMutationPolicy</B>()</PRE>
<DL>
<DD>Returns the mutation policy.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>mutation policy</DL>
</DD>
</DL>
<HR>

<A NAME="getMutationRate()"><!-- --></A><H3>
getMutationRate</H3>
<PRE>
public double <B>getMutationRate</B>()</PRE>
<DL>
<DD>Returns the mutation rate.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>mutation rate</DL>
</DD>
</DL>
<HR>

<A NAME="getSelectionPolicy()"><!-- --></A><H3>
getSelectionPolicy</H3>
<PRE>
public <A HREF="../../../../../org/apache/commons/math3/genetics/SelectionPolicy.html" title="interface in org.apache.commons.math3.genetics">SelectionPolicy</A> <B>getSelectionPolicy</B>()</PRE>
<DL>
<DD>Returns the selection policy.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>selection policy</DL>
</DD>
</DL>
<HR>

<A NAME="getGenerationsEvolved()"><!-- --></A><H3>
getGenerationsEvolved</H3>
<PRE>
public int <B>getGenerationsEvolved</B>()</PRE>
<DL>
<DD>Returns the number of generations evolved to reach <A HREF="../../../../../org/apache/commons/math3/genetics/StoppingCondition.html" title="interface in org.apache.commons.math3.genetics"><CODE>StoppingCondition</CODE></A> in the last run.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>number of generations evolved<DT><B>Since:</B></DT>
  <DD>2.1</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/GeneticAlgorithm.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/FixedGenerationCount.html" title="class in org.apache.commons.math3.genetics"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/commons/math3/genetics/InvalidRepresentationException.html" title="class in org.apache.commons.math3.genetics"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html?org/apache/commons/math3/genetics/GeneticAlgorithm.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="GeneticAlgorithm.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright &#169; 2003-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
